//
//  SecondViewController.m
//  UI0508__通讯录作业
//
//  Created by dllo on 16/6/18.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SecondViewController.h"

#define WIDTH  self.view.frame.size.width

#define HEIGHT self.view.frame.size.height



@interface SecondViewController ()<UITextFieldDelegate>

@end

@implementation SecondViewController

- (void)dealloc{
    
    
    [_number release];
    [_name release];
    [_imageButton release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    // Do any additional setup after loading the view.
    
    [self creatImageButton];
    [self creatNameText];
    [self creatNumberTextField];
    
    self.name.delegate = self;
   
}





- (void)creatImageButton{
    
    self.imageButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.imageButton.backgroundColor = [UIColor cyanColor];
    self.imageButton.frame = CGRectMake(WIDTH / 2 - 50, 100, 100, 100);
    [self.view addSubview:self.imageButton];
    
    //改成圆的
    self.imageButton.layer.masksToBounds = YES;
    self.imageButton.layer.cornerRadius = 50;
    
    
    
    
    
    
}

- (void)creatNumberTextField {
    
    self.name = [[UITextField alloc]initWithFrame:CGRectMake(WIDTH / 2 - 100, 250, 200, 50)];
    self.name.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:self.name];
    [_name release];

}

- (void)creatNameText{
    
    self.number = [[UITextField alloc]initWithFrame:CGRectMake(WIDTH / 2 - 100, 350, 200, 50)];
    self.number.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:self.number];
    [_number release];
    

    
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    
    [self.view endEditing:YES];
    return YES;
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
